package com.wswy.wzcx.ui.car.result;


import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import com.facebook.drawee.view.SimpleDraweeView;
import com.wswy.wzcx.R;
import com.wswy.wzcx.model.AdModel;
import com.wswy.wzcx.model.home.RouterUtils;
import com.wswy.wzcx.utils.ImageUtils;

class ResultAdView {


  static void load(ViewGroup container,final AdModel adModel){
    SimpleDraweeView imgAD = container.findViewById(R.id.img_ad);

    if(imgAD != null && adModel != null){

      if(TextUtils.isEmpty(adModel.imgUrl)){
        imgAD.setVisibility(View.GONE);
      }else {
        imgAD.setVisibility(View.VISIBLE);

        ImageUtils.showImage(imgAD,adModel.imgUrl);

      }


      imgAD.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

          RouterUtils.startTarget(v.getContext(),adModel.linkTarget,adModel.linkUrl);

        }
      });

    }


  }



}
